package com.msc.mc.util.data;

import java.util.Properties;

public class MaterialSeqKey {
	
	
	public  static String getNextSeq( String seqKey ) {
		try {
			String propPath = "/data/mc_workspaces/NIO_MC/portals/NIO/config/materialSeq.properties";
			Properties prop = new java.util.Properties();
			prop.load( new java.io.FileInputStream( propPath ) );
			String seq = prop.getProperty( seqKey );
			String newSeq = String.valueOf( Integer.parseInt( seq ) + 1 );
			prop.put( seqKey , newSeq );
			prop.store( new java.io.FileOutputStream( propPath ) , "" );
			return newSeq;
		} catch ( Exception e ) {
			e.printStackTrace();
		}
		return null;
	}
	
	public static void main( String[] args ) {
		System.out.println(  MaterialSeqKey.getNextSeq( "K1" ) );
		System.out.println(  MaterialSeqKey.getNextSeq( "K1" ) );
	}
}

